﻿@using GTAuto.DAL.DAL
@model GTAuto.DAL.Entities.GTBrand
@{
    ViewBag.Title = "BrandEdit";
    Layout = "~/Views/Shared/_Layout.cshtml";

    SelectList selectList = ViewBag.gtBrandTypes;
    List<string> err = ViewBag.Errs;
}
<h4 class="alert_info">
    @if (Model.Id > 0)
    {
        <div>
            Редактирование бренда</div>
    }
    else
    {
  
        <div>
            Создание нового бренда</div>
    }
</h4>
@using (Html.BeginForm("BrandEdit", "Dictionary", FormMethod.Post, new { @class = "jNice", enctype = "multipart/form-data" }))
{

    if (err != null && err.Count != 0)
    {

        foreach (var er in err)
        {

    <h4 class="alert_error">
        @er</h4>

        }
    }
    if (ViewBag.Succes != null)
    {
    <h4 class="alert_success">
        @ViewBag.Succes</h4>
    }

    <article class="module width_full">
        <header><h3>Данные о бренде</h3></header>
        <div class="module_content">
            <fieldset>
                <label>Название</label>
                <input type="text" id="Name" name="Name" value="@Model.Name" />
            </fieldset>
            <fieldset>
                <label>Описание</label>
               <textarea rows="10" cols="1" name="Description" id="Description">@Model.Description</textarea>
            </fieldset>
            <fieldset > <!-- to make two field float next to one another, adjust values accordingly -->
                <label>Тип бренда:</label>
                @Html.DropDownList("Type", selectList)
            </fieldset>
            
            
            <fieldset style="width: 100%; float: left; margin-right: 3%;">
                 <label>
                    Лого(круп.) :</label><input type="file"  id="LogoPath" name="LogoPath" value="@Model.LogoPath" />
            </fieldset>

             @if (!string.IsNullOrEmpty(Model.LogoPath))
             {
                <p>
                    <img src="@string.Format("{0}/{1}", DALSettngs.Singleton.Get("BrendLogosAdminView").Value, Model.LogoPath)"/>
                </p>
             }
              <fieldset style="width: 100%; float: left; margin-right: 3%;">
                 <label>
                    Лого(мелк.) :</label><input type="file" class="text-long" id="SmallLogoPath" name="SmallLogoPath" value="@Model.SmallLogoPath" />
            </fieldset>
            
             @if (!string.IsNullOrEmpty(Model.SmallLogoPath))
             {
                <p>
                    <img src="@string.Format("{0}/{1}", DALSettngs.Singleton.Get("BrendLogosAdminView").Value, Model.SmallLogoPath)"/>
                </p>
             }
            <div class="clear"></div>
        </div>
        <footer>
            <div class="submit_link">
               
                <input type="submit" value="Сохранить" class="alt_btn">
               
            </div>
        </footer>
    </article>
}
<!-- end of post new article -->
<div class="spacer">
</div>
